package medium最长增序子列;

public class Solution {
    public int lengthOfLIS(int[] nums) {
        int max = 0;
        int n = nums.length;
        int[] count = new int[n];
        count[0] = 1;
        for (int i = 1; i < n; i++) {
            for (int j = i; j > 0; j--) {
                if (nums[i] > nums[j-1])
                    count[i] = Math.max(count[i],count[j-1]+1);
                else
                    count[i] = Math.max(count[i],1);
            }
            max = Math.max(count[i],max);
        }

        return Math.max(max,count[0]);
    }
}
